08. Build Tools

Build Tools

Make and CMake are two separate and similar build tools that both serve to help simplify the process of building software.

In particular, build tools automate the process of compiling multiple source code files into object files, linking those object files together, and generating an executable. Build tools also often automate the process of determining which files have changed since the last build and thus need to be recompiled.

C++ Build Process

C++ Build Process

Make

GNU Make is a widely-used build tool that relies on Makefiles to automate the process of building a project.

A Makefile typically includes one or more "targets". Each target performs a different action.

build is a common target name that is configured in the Makefile to compile all of the project's source code into an executable file. clean, on the other hand, is a common target to delete all object files and other artifacts of the build process, resulting in a clean, unbuilt project state.

Running either make build or make clean (or any other target) on the command line would cause Make to search for a local Makefile, search for a matching target within that Makefile, and then execute the target.

GNU provides

CMake

CMake is a built tool that facilitates cross-platform builds, so that it is straightforward to build the same source code on Linux, macOS, Windows, or any other operating system. CMake relies on a CMakeLists.txt file, which configures appropriate cross-platform targets.

Building a CMakeLists.txt file can be a bit daunting, but CMake provides a helpful tutorial.

In this Nanodegree program, you will not need to build your own Makefiles or CMakeLists.txt files. We provide the appropriate configuration files for each project and instruct you as to their usage.